<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/fuman/js/order.js"></script>
<script>
   
	 function onstsubmit()
	{
		$('#expressform').modal('hide');	
		$('#wuyuform').submit();
	}

    function Dodistribution()
    {
        var str = selectallpro();
        if(str !=false)
        {
            $.post("/deliverorder/ajaxbutton", {"op": "dodistribution","str":str},
                    function(data){
                        if(data==200)
                        {
                            document.location.href = '/deliverorder/aliexpressOrder';
                        }
                    },"json");
        }
    }
    function delone(id,t)
    {
        if(confirm("确定移除?"))
        {
            $.post("/deliverorder/ajaxbutton", {"op": "delone","id":id,"st":t},
                    function(data){
                        if(data.txt==200)
                        {
                            //document.location.href = data.url;
                            location.reload();
                            return;
                        }
                        if(data.txt==201)
                        {
                            alert(data.text);
                            return ;
                        }

                        return;
                    },"json");
        }
    }
	 function showExpressForm(type){
        var submit_act = new Array();
        submit_act['yanwen'] = "/order/ajaxbutton?op=WUYexpress";
        $("#expressOrderForm").attr("action", submit_act[type]);
        $("#type").val(type);
        if(type=='yanwen')
        {
            $("#showmabang").show();
        }
		var Num=""; 
			for(var i=0;i<11;i++) 
			{ 
				Num+=Math.floor(Math.random()*10);
			} 
			$("#kdnumber").val(Num);
        $('#expressform').modal('show');
    }

     //导入pdf文件
     function OrderIn(id) {
         $("#mabang_id").val(id);
         $('#excelorderform').modal('show');
     }
     //导入excel
     function doImportExcel() {
         var mabang_id = $("#mabang_id").val();
         if(mabang_id==""){
             alert("参数错误");return false;
         }
         var deliver_num = $("#deliver_num").val();
         if(deliver_num==""){
             alert("运单号必须填写");return false;
         }
         /* FormData 是表单数据类 */
         var fd = new FormData();
         var ajax = new XMLHttpRequest();
         fd.append("upload", 1);
         /* 把文件添加到表单里 */
         fd.append("upfile", document.getElementById("file_excel").files[0]);
         fd.append("mabang_id",mabang_id);
         fd.append("deliver_num",deliver_num);
         fd.append("op","importPdfFile");
         ajax.open("post", "/deliverorder/ajaxbutton", true);
         ajax.send(fd);
         ajax.onload = function () {
             //console.log(ajax.responseText);
             if(ajax.responseText == 200){
                 alert("上传成功");
                 location.reload();
             }else{
                 alert(ajax.responseText);
             }
         };

     }
</script>
<title>无忧物流列表</title>
<body class="withvernav">
<div class="bodywrapper"> {{include file='/public/leftmenu.tpl'}}
    <div class="centercontent">
        <div class="pageheader notab">
            <h1 class="pagetitle">无忧物流列表</h1>
            <span class="pagedesc"></span>
            <div class="menulist">
                <ul class="profile_summary">
                
                   <li><a href="javascript:showExpressForm('aliexpressOrder');" class=""><span>无忧交运</span></a></li>
                    <li><a href="/exportorder/ajaxbutton?op=aliexpresswuliu"  target="_blank"><span>批量交运无忧</span></a></li>
                    
                     <li><a href="/exportorder/ajaxbutton?op=aliexpresswuliuTwo"  target="_blank"><span>批量二次交运</span></a></li>
                     
                     <li><a href="/deliverorder/ajaxbutton?op=showAliaddressconfig"  target="_blank"><span>回邮地址配置</span></a></li>
                </ul>
            </div>
        </div>
        <!--pageheader-->

        <div id="contentwrapper" class="contentwrapper">
            <div id="basicform" class="subcontent">
                <!--搜索栏-->
                <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
                <form class="stdform stdform2" method="get" action="/deliverorder/aliexpressOrder">
                    <input type="hidden" name="orderType" id="orderType" value="9" >
                    <div class="tableoptions"> 交运时间：
                        <input type="text"  name="starttime" value="{{$starttime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" /> - <input type="text"  name="endtime" value="{{$endtime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" />
                        关键词: <input type="text" name="other" id="other" class="width100" value="{{$other}}" placeholder="订单号或运单号" />
                        &nbsp;
                        订单状态:
                        <select name="statusst" class="selection" style="width:100px;">
                            <option value=""  selected>请选择</option>
                            <option value="1" {{if $statusst==1}} selected{{/if}}>已支付</option>
                            <option value="2" {{if $statusst==2}} selected{{/if}}>配货中</option>
                            <option value="3" {{if $statusst==3}} selected{{/if}}>已完成</option>
                        </select>
                      
                        <button class="btn btn_orange btn_search radius50">Search</button>
                        &nbsp;  &nbsp;
                        <a href="?isexe=1">{{if $isexe==1}}<font color="red">交运成功</font>{{else}}交运成功{{/if}}</a>
                        &nbsp;  &nbsp;
                        <a href="?isexe=2">{{if $isexe==2}}<font color="red">交运失败</font>{{else}}交运失败{{/if}}</a>
                        &nbsp;  &nbsp;
                        <a href="?isexe=3">{{if $isexe==3}}<font color="red">未交运</font>{{else}}未交运{{/if}}</a>
                        &nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;
                        <a href="javascript:void(0)" onClick="moreopenMailNoUrl(1,9)" class="btn btn2 btn_help"><span>打印标签</span></a>
                        &nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;
                        <a href="javascript:void(0)" onClick="Dodistribution()" class="btn btn2 btn_help"><span>标配货</span></a>
                    </div>
                </form>
                <!--搜索栏结束-->

                <table cellpadding="0" cellspacing="0" border="0" class="stdtable">

                    <thead>
                    <tr>
                        <th class="head0"><input name="allchk" id="allchk" type="checkbox" onClick="allSelect('ppid[]')"></th>
                        <th class="head1">订单号</th>
                        <th class="head1">状态</th>
                        <th class="head1" width="9%">客户名称</th>
                        <th class="head1">来源平台</th>
                        <th class="head1">国家</th>
                        <th class="head1">操作人</th>
                        <th class="head1">状态</th>
                        <th class="head1">运单号</th>
                        <th class="head1">交运时间</th>
                        <th class="head1">发货方式</th>
                        <th class="head1">操作</th>

                    </tr>
                    </thead>

                    {{foreach from=$orderlist item=detail key=key}}
                    <tr>
                        <td><input name="ppid[]" type="checkbox" value="{{$detail.id}}"></td>

                        <td>
                        {{if $detail.isform==1}}
                         <a href="http://192.168.1.100:89/eshop/order.do?method=edit&orderid={{$detail.orderID}}" target="_blank">{{$detail.orderID}}</a>
                        {{else}}
                        <a href="/orderlist/orderlist?kw={{$detail.orderID}}" target="_blank">{{$detail.orderID}}</a>
                        {{/if}}
                        </td>
                        <td>{{$detail.statusst}}</td>
                        <td>{{$detail.customerid}}</td>
                        <td>{{$detail.customertype}}</td>
                        <td>{{$detail.customerqq}}</td>
                        <td>{{$detail.createUser}}</td>
                        <td>{{if $detail.isexe==1}}交运完成{{/if}}{{if $detail.isexe==2}}交运失败{{/if}}{{if $detail.isexe==0}}未交运{{/if}}
                        {{if $detail.isexe==3}}等待二次交运{{/if}}
                        </td>
                        <td class="width200">{{if $detail.isexe==1}}{{$detail.mailNo}}{{/if}}{{if $detail.isexe==2}}{{$detail.exememo}}{{/if}}{{if $detail.isexe==0}}{{$detail.exememo}}{{/if}}{{if $detail.isexe==3}}{{$detail.exememo}}{{/if}}</td>
                        <td>{{$detail.mailinstime}}</td>
                        <td>{{$detail.deliver}}</td>
                        <td> {{if $detail.isexe==2}}<a href="javascript:void(0)" onClick="delone({{$detail.id}},'delyuntuexpress')">删除</a>{{/if}}  {{if $detail.isexe==0}}<a href="javascript:void(0)" onClick="delone({{$detail.id}},'delyuntuexpress')" >删除</a>{{/if}}

                            {{if $managers || in_array('101',$showpower)}}{{if $detail.isexe==1}}<a href="javascript:void(0)" onClick="delone({{$detail.id}},'delyuntuexpress')" >删除</a> | {{/if}}{{/if}}
                            {{if $detail.isexe==1}}<!--<a href="{{$detail.printUrl}}" target="_blank">标签A</a>&nbsp;&nbsp;|&nbsp;&nbsp;--><a href="/{{$detail.printUrl}}" target="_blank">标签</a>{{/if}}

                            {{if $detail.isexe==2}}
                                &nbsp;<!-- 临时执行上传文件功能 -->
                            <button class="stdbtn btn_black" onClick="OrderIn({{$detail.id}})">pdf上传</button>
                            {{/if}}


                        </td>
                    </tr>
                    {{/foreach}}



                </table>

                <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
            </div></div>
       
        
        
        
         <!-- 模态框（Modal）交运内容 -->
<form action="/order/ajaxbutton?op=WUYexpress"  method="post" name="wuyuform" id="wuyuform" target="_blank">
<input type="hidden" name="type" id="type">
  <div class="modal fade" id="expressform" tabindex="-1" role="dialog" aria-labelledby="sexpressform" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="sprintform">待交运订单编号</h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0" id="shipment_order_table">
            <tr>
              <td width="100">订单号： </td>
              <td align="left"><textarea name="orderlist" id="orderlistst" cols="10" rows="10"></textarea></td>
            </tr>
            <tr id="showmabang">
              <td>交运马帮订单： </td>
              <td align="left" style="color:#999"><input name="isformMabang" type="checkbox" value="1"> 上面填写订单号为马帮订单号时，这里打勾</td>
            </tr>
          	
            <tbody  id="wuytype_tr">
    		<tr >
            <td>配送方式</td>
            <td><select name="pickstyle">
                <option value="0" selected>上门揽收</option>
                <option value="1">自行配送</option>
             </select></td>
			</tr>
            <tr >
            <td> 国内快递</td>
            <td>  <select name="kd">
                <option value="">-请选择-</option>
                   <option value="505">顺丰速运</option>
                   <option value="2">EMS</option>
                   <option value="102">韵达快递</option>
                   <option value="500" selected>中通快递</option>
                   <option value="-1">其他</option>
                   <option value="504">天天快递</option>
                   <option value="1216">全峰快递</option>
                   <option value="1152">中铁物流</option>
                   <option value="101">圆通速递</option>
                   <option value="100">申通快递</option>
             </select>
			</td>
			</tr>
             <tr >
            <td> 快递单号</td>
            <td>  <input class="small_input" type="text" style="width:30mm;" name="kdnumber" id="kdnumber">
			</td>
			</tr>
             <tr >
            <td> 线上发货物流</td>
            <td>  <select name="Expressqudao" style="width:200px;">
                               <option value="">-请选择-</option>
                                  <option value="CAINIAO_STANDARD_TS_1710315" selected>江苏省苏州市昆山市花桥镇	花集路668号宝湾物流1号库1号门 </option>
                            </select>
			</td>
			</tr>
              <tr >
            <td> 是否含电池</td>
            <td>   <select name="isbattery">
                <option value="0" selected>无电池</option>
                <option value="1">有电池</option>
             </select>

			</td>
			</tr>
               <tr >
            <td> 不可达处理</td>
            <td><select name="UndeliverableDecision">
             	<option value="-1">未选择</option>
                <option value="0" selected>退回</option>
                <option value="1">销毁</option>
             </select>


			</td>
			</tr>
            </tbody>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-primary"  onclick="onstsubmit()"> 提交 </button>
            <button type="button" class="btn btn-default" 
               data-dismiss="modal" style="display:none"> 关闭 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
 </form>

        <!-- 导单订单EXCEL-->
        <!-- 模态框（Modal）交运内容 -->
        <form action="/deliverorder/ajaxbutton?op=importPdfFile" enctype="multipart/form-data" method="post" name="excelattributeform" id="excelattributeform" target="_blank">
            <div class="modal fade" id="excelorderform" tabindex="-1" role="dialog" aria-labelledby="sexpressform" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"
                                    aria-hidden="true">× </button>
                            <h4 class="modal-title"><span id="order_mailno">pdf文件导入</span></h4>
                        </div>
                        <div class="modal-body">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="100">请输入运单号： </td>
                                    <td align="left">
                                        <input  type="text" name="deliver_num" id="deliver_num" value="" style="width: 120px;" placeholder="请输入运单号"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="100">导入pdf文件： </td>
                                    <td align="left">
                                        <input  type="file" name="file_excel" id="file_excel" />
                                    </td>
                                </tr>
                            </table>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default"
                                        data-dismiss="modal" style="display:none"> 关闭 </button>
                                <input type="hidden" name="mabang_id" id="mabang_id" value="">
                                <button type="button" class="btn btn-primary"  onclick="doImportExcel()">导入</button>
                            </div>
                        </div>
                        <!-- /.modal-content -->
                    </div>
                    <!-- /.modal-dialog -->
                </div>
            </div>
        </form>
        <!-- /.modal -->
<div id="goToTop" style="display:none"><a href="javascript:;">TOP</a></div>
</body>
</html>